package com.taoyuan.hotel.controller;

import com.taoyuan.hotel.entity.Employee;
import com.taoyuan.hotel.service.intf.EmployeeService;
import com.taoyuan.hotel.vo.PageBean;
import com.taoyuan.hotel.vo.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/employee/")
public class EmployeeController {
    @Autowired
    private EmployeeService service;

    @PostMapping("save.do")
    public R save(Employee employee){
        return service.save(employee);
    }

    @GetMapping("page.do")
    public PageBean page(int page, int limit){
        return service.all(page, limit) ;
    }

    @PostMapping("del.do")
    public R del(int id){
        return service.del(id);
    }

    @PostMapping("update.do")
    public R update(Employee employee){
        return service.update(employee);
    }

    @GetMapping("pageany.do")
    public PageBean pageAny(String name, int page, int limit){
        return service.selectAny(name, page, limit);
    }

    @PostMapping("delbatch.do")
    public R delBatch(@RequestBody int[] ids){
        return service.delBatch(ids);
    }
}
